<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 这篇用到了这个铂金算法
        // https://juejin.cn/post/7004599447795548191
        // 生成 nums：
        let nums = []
        for (let i = 1; i <= 54; i++) {
            nums.push(i)
        }

        // 铂金洗牌算法：
        const FYShuffle = function (nums) {

            const radomNums = nums.slice(0);
            let len = radomNums.length;

            while (len > 1) {
                let rand = Math.floor(Math.random() * len);
                len--;
                let temp = radomNums[len];
                radomNums[len] = radomNums[rand];
                radomNums[rand] = temp;
            }

            return radomNums;
        }

        console.log(FYShuffle(nums))
// (54) [47, 17, 33, 13, 37, 26, 20, 39, 45, 44, 25, 40, 49, 7, 36, 38, 6, 15, 31, 18, 52, 46, 28, 11, 43, 1, 22, 19, 53, 9, 14, 27, 35, 8, 51, 42, 50, 2, 23, 5, 30, 54, 4, 21, 29, 16, 10, 24, 48, 34, 32, 12, 41, 3]

    </script>
</body>

</html>